package com.pubinfo.passbook.common.model.ruler;

import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.pubinfo.passbook.common.entity.TRuleGenus;
import com.pubinfo.passbook.common.model.bo.witeoff.MedicineOnJobOrRetireBO;
import com.pubinfo.passbook.common.model.dto.witeoff.MedicineOnJobOrRetireDTO;
import com.pubinfo.passbook.common.model.dubbo.ESBServiceData;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class Reimbursement {
  /*序号*/
  private String serialNumber;
  /*员工姓名*/
  @ColumnWidth(15)
  private String name;
  /*部门*/
  private String department;
  /*员工类型*/
  private String staffType;
  /*供属姓名*/
  private String genusName;
  /*供属关系*/
  private String genusRelationship;
  /*工龄*/
  private String workAge;
  /*住院/门诊*/
  private String passbookType;
  /*是否特殊病种*/
  private String isSpecial;
  /*单据数量*/
  private String passbookNub;
  /*医疗费总额*/
  private BigDecimal totalAmount;
  //    /*纳入报销范围金额*/
//    @ColumnWidth(20)
//    private BigDecimal reimbursementContain;
//    /*报销比例*/
//    @NumberFormat("#.##%")
//    private Double reimbursementRatio;
//    /*报销金额*/
//    private BigDecimal reimbursementSum;
  /*核报金额*/
  private BigDecimal approvedAmount;
  
  public Reimbursement(Integer passbookNub, BigDecimal totalAmount, BigDecimal approvedAmount) {
    this.serialNumber = "合计";
    this.passbookNub = passbookNub.toString();
    this.totalAmount = totalAmount;
    this.approvedAmount = approvedAmount;
  }
  
  public Reimbursement(MedicineOnJobOrRetireDTO jobDTO, ESBServiceData.CertDetail certDetail, BigDecimal totalAmount, BigDecimal sum, byte type, Integer number) {
    this.name = certDetail.getStaffName();
    this.workAge = certDetail.getWorkTime();
    this.passbookType = type == 0 ? "门诊" : "住院";
    this.staffType = certDetail.getStaffStatus();
    this.passbookNub = number.toString();
    this.department = certDetail.getDeptName();
    this.isSpecial = jobDTO.getIsSpecial() ? "是" : "否";
    this.totalAmount = totalAmount;
    this.approvedAmount = sum;
  }

  public Reimbursement(String reviewer,String auditTime)
  {
    this.serialNumber="审核人";
    this.staffType=reviewer;
    this.workAge="审核时间";
    this.passbookNub=auditTime;
  }
  
  public Reimbursement(MedicineOnJobOrRetireDTO jobDTO, ESBServiceData.CertDetail certDetail, TRuleGenus tRuleGenus, BigDecimal totalAmount, BigDecimal sum, byte type, Integer number) {
    this.genusName = tRuleGenus.getGenusName();
    this.genusRelationship = tRuleGenus.getRelationship();
    new Reimbursement(jobDTO, certDetail, totalAmount, sum, type, number);
  }

    public Reimbursement() {

    }

  //设置计算后得出的结果
  public void setReimbursement(BigDecimal totalAmount, BigDecimal reimbursementContain, BigDecimal reimbursementSum) {
    this.totalAmount = totalAmount;
//        this.reimbursementContain=reimbursementContain;
//        this.reimbursementRatio=reimbursementContain.divide(totalAmount,4,BigDecimal.ROUND_HALF_UP).doubleValue();
//        this.reimbursementSum=reimbursementSum;
    this.approvedAmount = reimbursementSum;
  }//设置员工姓名、部门、员工类型、供属姓名、供属关系、
  
  // 工龄、住院/门诊、单据数量、是否特殊病种等信息（从人力系统获取）
  /*部门、员工类型和工龄未写*/
  public void setUser(String name, TRuleGenus tRuleGenus, String passbookType, Integer passbookNub, String isSpecial) {
    this.name = name;
    this.genusName = tRuleGenus.getGenusName();
    this.genusRelationship = tRuleGenus.getRelationship();
    this.passbookType = passbookType;
    this.passbookNub = passbookNub.toString();
    this.isSpecial = isSpecial;
  }
}
